<!DOCTYPE html>

<html>
    <head>
        <meta charset="UTF-8">
        <title>课程列表</title>
    </head>
    <body>

        <table border="1" width="80%" align="center">
            <tr>
                <th>课程代码</th>
                <th>课程名称</th>
                <th>课时</th>
                <th>学分</th>
                {% if login %}
                <th>操作</th>
                {% endif %}
            </tr>
            {% for c in courses %}
            <tr>
                <td>{{c.number}}</td>
                <td>{{c.name}}</td>
                <td>{{c.hours}}</td>
                <td>{{c.credit}}</td>
                {% if login %}
                <td>
                    <a href="/course/edit/{{c.id}}">编辑</a>
                    <a href="/course/remove/{{c.id}}">删除</a>
                </td>
                {% endif %}
            </tr>
            {% else %}
            <tr>
                <td>
                    <a href="/course/add">添加课程</a>
                </td>
            </tr>
            {% endfor %}
        </table>
        
    </body>
</html>